%% 
 %1
opr = input('请输入四则运算符：','s');
a = (floor(rand(1)*90+10));
b = (floor(rand(1)*90+10));
a
b
if opr == '+'
    c = a + b;
elseif opr == '-'
    c = a - b;
elseif opr == '*'
    c = a .* b;
elseif opr == '/'
    c = a ./ b;
else
    disp('输入错了')
end
c
%% 


 %2

 
x = -6:0.1:6;
if(x < 0 & x ~= -3)
     z =@(x) x.^2+x-6;
elseif(0 < x & x<10 & x ~= 2 & x ~= 3)
      z =@(x) x.^2-5*x +6;
else
     z =@(x) x.^2-x-1;
end

A = [z(-5.0) z(-3.0) z(1.0) z(2.0) z(2.5) z(3.0) z(5.0)]

%3
a(1) = 1;
a(2) = 1;
a(3) = a(2)+a(1)
i = 3;
while(a(i-1) <10000)
 
  a(i) = a(i-1)+a(i-2);
  i =  i + 1;
end
 i=i-1;
 i
 a(i)
 a(21)
 %4

 f= zeros(1,50);
 f(1) = 1;f(2) = 0;f(3) = 1; 
 for n = 4:1:50
     f(n) = f(n-1) - 2*f(n-2) - f(n-3);
 end
    x = find(f ==(max(f)))
    y = find(f ==(min(f)))
    SUM = sum(sum(f))
 MAX = f(x)
 MIN = f(y)
 %5

 function s = count_pi(n)
 s = 0;
 n=1000;
 for(i=1:n)
     s = s + 1/i^2;
 end
 pi = sqrt(6*s);
 fprintf('pi的近似值为%.6f',pi)
 end

%6
function s = f(n)
s = input('请输入一个值');
s = num2str(s);
c = strlength(s);
for i = 1:c
a(i) = str2num(s(i));
end
a
end